package com.example.demo.controller;

import com.example.demo.model.User;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@Controller
@ResponseBody
@RequestMapping("/user")
@Slf4j
public class UserController {

//    private Logger logger = LoggerFactory.getLogger(UserController.class);

    public void logger() {
        log.trace("trace");
        log.debug("debug");
    }
    @Value("${myobj.name}")
    private String name;
    @PostConstruct
    public void doPostConstruct() {

        System.out.println(user);
    }

    @Autowired
    private User user;
}
